# -*- coding = utf-8 -*-
# @Time : 2020/7/11 11:48
# @Author : gxm

import cv2
from  shibie.Plate_cut import  Plate_cut_run
from  shibie.Chars_cut import  chars_cut_run
from shibie.svm_predict import plate_predict
from shibie.Predicter import getPlate


def plate_recodnition1(img):#gxm写的
    plate_img=Plate_cut_run(img)
    chars_img=chars_cut_run(plate_img)
    string=plate_predict(chars_img)
    #cv2.imshow("aa",plate_img)
    #cv2.waitKey(0)
    #string = getPlate(plate_img)
    print(string)
    return string


def plate_recodnition(img):#gxm写的
    try:
        plate_img=Plate_cut_run(img)
        chars_img=chars_cut_run(plate_img)
        #string=plate_predict(chars_img)
        #cv2.imshow("aa",plate_img)
        #cv2.waitKey(0)
        string = getPlate(plate_img)
        print(string)
        return string
    except:
        return ''


if __name__ == "__main__":
    # 绝对地址，记得改一下 好的
    img = cv2.imread("D:/pycharmcode/web/static/images/5.jpg")
    print(plate_recodnition(img))
